import 'package:acgn_pioneer/components/sms_code.dart';
import 'package:acgn_pioneer/plugin/dialog/index.dart';
import '../../public.dart';

mixin SendSMSMixin<S extends StatefulWidget> on State<S> {
  String phone;
  String dialCode = '+86';

  sendsms() {
    ACGNDialog(
      context,
      barrier: DialogBarrier(barrierDismissible: true),
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(8),
        side: BorderSide.none,
      ),
      width: 296,
      body: DialogBody(
          padding: EdgeInsets.all(0),
          content: SMSCode(phone, dialCode: dialCode, callback: callbackSMS)),
    ).show();
  }

  callbackSMS() {
    Routers.navigateTo(RouterPage.VERIFICATION_CODE_PAGE,
        replace: true, params: {'dialCode': dialCode, 'phone': phone});
  }
}
